<?php


namespace app\admin\controller\garbage;


use app\admin\controller\Base;
use app\common\enums\ErrorCode;
use app\common\service\BaseService;
use app\common\vo\ResultVo;
use think\facade\Request;

class GarbageController extends Base
{
    /**
     * 垃圾分类搜索:default:NULL
     * @route("garbage/index")->allowCrossDomain();
     * @return string API results
     */
    public function index()
    {
        $url = "http://wz.jianduanseo.com/lajifenlei/index.php?m=Home&c=Index2&a=check";
        $keywords = Request::request('keywords', '0');
        $params = ['keywords' => $keywords];
        $result = BaseService::curl_post($url, $params);
        if ($result) {
            return $result;
        } else {
            return ResultVo::error(ErrorCode::VALIDATION_FAILED);
        }
    }

}